<!--  -->
<template>
  <div>
        <Card>
                <div slot="title" >
                    <Button v-if="btnp.zsku_xztm" @click="handleClickAddForm" class="zh-hollow" type="primary" icon="plus-round">新增条目</Button>
                    <Button v-if="btnp.zsku_cwxdztj" @click="modal_addOther=true" class="zh-hollow" type="warning" style="margin-left:25px;">从维修单中添加</Button>
                </div>
                <Form :model="formItem" :label-width="70">
                    <Row :gutter="10" type="flex"  align="middle"  >
                        <Col span="8">
                            <FormItem label="条目标题">
                                <Input v-model="formItem.title" clearable></Input>
                            </FormItem>
                        </Col>
                        <Col span="8">
                            <FormItem label="类型">
                                <Select v-model="formItem.type" >
                                    <Option  v-for="item in typeList" :value="item.state" :key="item.state">{{ item.desc }}</Option>
                                </Select>
                            </FormItem>
                        </Col>
                        <Col span="8">
                            <FormItem label="标签">
                                <Select v-model="formItem.label" filterable>
                                    <Option  v-for="item in tagList" :value="item.state" :key="item.state">{{ item.desc }}</Option>
                                </Select>
                            </FormItem>
                        </Col>
                    <!-- </Row>
                    <Row :gutter="10" type="flex" justify="space-between" align="middle"  > -->
                        <Col span="8">
                            <FormItem label="条目来源">
                                <Select v-model="formItem.source" >
                                    <Option  v-for="item in sourceList" :value="item.state" :key="item.state">{{ item.desc }}</Option>
                                </Select>
                            </FormItem>
                        </Col>
                        <Col span="8">
                            <FormItem label="条目类型">
                                <Select v-model="formItem.entryType" >
                                    <Option  v-for="item in itemTypeList" :value="item.state" :key="item.state">{{ item.desc }}</Option>
                                </Select>
                            </FormItem>
                        </Col>
                        <Col span="12">
                            <FormItem label="新增时间">
                                <DatePicker v-model="timeRange" format="yyyy-MM-dd HH:mm" type="datetimerange" placement="bottom-end" placeholder="请选择开始和结束时间"></DatePicker>
                            </FormItem>
                        </Col>
                    </Row>
                    <Row :gutter="10" >
                        <Col span="8" offset="16"  style="text-align:right;">
                            <Button @click="searchgetTable" class="zh-hollow" type="primary" icon="ios-search-strong">搜索</Button>
                        </Col>
                    
                    </Row>
                </Form>
        </Card>
        <Card style="margin-top:10px;" :padding="0">
            <Table :loading="loading" border :columns="columns" :data="data"></Table>
            <Page :current.sync="formItem.pageNumber" :total="total" show-total show-sizer @on-change="pageChange" @on-page-size-change="pageSizeChange"></Page>
        </Card>
        <Modal  :title="modal_knowledge_title" v-model="modal_knowledge"  :mask-closable="false" >
            <Form :model="knowledgeForm" :label-width="80" style="padding:15px 30px;">
                <FormItem label="条目类型*">
                    <Input v-if="modal_knowledge_title==='编辑知识条目'||!!repaireNumber" :value="knowledgeForm.entrytype=='1'?'知识':'故障'" readonly ></Input>
                    <Select v-else  v-model="knowledgeForm.entrytype" @on-change="entrytypeChange" >
                        <Option  v-for="item in entrytypeList" :value="item.value" :key="item.value">{{ item.label }}</Option>
                    </Select>
                </FormItem>
                <FormItem label="条目标题*">
                    <Input v-model="knowledgeForm.title" :maxlength="20" clearable></Input>
                </FormItem>
                <template v-if="knowledgeForm.entrytype==='1'">
                    <FormItem label="知识类型*">
                        <Select v-model="knowledgeForm.type" >
                            <Option  v-for="item in faultList" :value="item.state" :key="item.state">{{ item.desc }}</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="知识内容*">
                        <Input type="textarea" :autosize="{minRows: 2,maxRows: 5}" v-model="knowledgeForm.describe" ></Input>
                    </FormItem>
                </template>
                <template v-if="knowledgeForm.entrytype==='2'">
                    <FormItem label="故障类型*">
                        <Input readonly v-if="!!repaireNumber" :value='defaultName'></Input>
                        <Select v-else v-model="knowledgeForm.type" >
                            <Option  v-for="item in faultList" :value="item.state" :key="item.state">{{ item.desc }}</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="故障表现*">
                        <Input type="textarea" :maxlength="200" :autosize="{minRows: 2,maxRows: 5}" v-model="knowledgeForm.describe" ></Input>
                    </FormItem>
                    <FormItem label="故障原因*">
                        <Input type="textarea" :maxlength="200" :autosize="{minRows: 2,maxRows: 5}" v-model="knowledgeForm.reason" ></Input>
                    </FormItem>
                    <FormItem label="解决办法*">
                        <Input type="textarea" :maxlength="200" :autosize="{minRows: 2,maxRows: 5}" v-model="knowledgeForm.solve" ></Input>
                    </FormItem>
                </template>
                <template v-if="!!knowledgeForm.entrytype">
                    <FormItem label="图片">
                        <div class="demo-upload-list" v-for="(item,index) in uploadList" :key="index">
                            <template v-if="item.status === 'finished'">
                                <img :src="domain+item.response.hash">
                                <div class="demo-upload-list-cover">
                                    <Icon type="ios-eye-outline" @click.native="handleView(domain+item.response.hash)"></Icon>
                                    <Icon type="ios-trash-outline" @click.native="handleRemove(item,index)"></Icon>
                                </div>
                            </template>
                            <template v-else>
                                <Progress v-if="item.showProgress" :percent="item.percentage" hide-info></Progress>
                            </template>
                        </div>
                        <Upload
                            v-if="uploadList.length<3"
                            ref="upload"
                            :show-upload-list="false"
                            :on-success="handleSuccess"
                            :format="['jpg','jpeg','png']"
                            :max-size="2048"
                            :on-format-error="handleFormatError"
                            :on-exceeded-size="handleMaxSize"
                            :before-upload="handleBeforeUpload"
                            :on-error="handleErr"
                            multiple
                            type="drag"
                            :data="upLoadData"
                            action=" http://upload.qiniup.com"
                            style="display: inline-block;width:58px;">
                            <div style="width: 58px;height:58px;line-height: 58px;">
                                <Icon type="ios-plus-empty" size="20"></Icon>
                            </div>
                        </Upload>
                    </FormItem>
                    <FormItem label="标签*">
                        <Input v-model="knowledgeForm.label" placeholder="不同标签之间用中文逗号隔开" clearable></Input>
                    </FormItem>
                </template>
            </Form>
            <div slot="footer">
                <div class="zh-flex zh-flex-5" >
                    <Button @click="modal_knowledge=false" type="ghost">放弃操作</Button>
                    <Button @click="judgeSaveKnow" class="zh-hollow" type="primary" >保存</Button>
                </div>
            </div>
        </Modal>
        
        <Modal loading title="从维修单中添加条目" v-model="modal_addOther"  :mask-closable="false"  class-name="vertical-center-modal">
            <Form :label-width="60" style="padding:15px 30px;">
                <FormItem label="维修单号">
                    <Input v-model="repaireNumber" clearable></Input>
                </FormItem>
            </Form>
            <div slot="footer">
                <div class="zh-flex zh-flex-5" >
                    <Button @click="modal_addOther=false" type="ghost">放弃操作</Button>
                    <Button @click="next" class="zh-hollow" type="primary" >下一步</Button>
                </div>
            </div>
        </Modal>
        <Modal title="查看知识条目" v-model="modal_viewKonw" class="no_footer_modal">
            <Form  :label-width="100" style="padding:15px 30px">
                <FormItem label="条目类型：">{{knowF.type}}</FormItem>
                <FormItem label="条目来源：">{{knowF.source}}</FormItem>
                <FormItem v-if="knowF.sourceName=='维修单转化'" label="维修单号：">{{knowF.number}}</FormItem>
                <FormItem v-if="knowF.sourceName=='维修单转化'" label="运维人员：">{{knowF.pro}}</FormItem>
                <FormItem label="新增时间：">{{knowF.addTime}}</FormItem>
                <FormItem label="标题：">{{knowF.title}}</FormItem>
                <template v-if="knowF.type=='知识'">
                    <FormItem label="知识类型：">{{knowF.faultType}}</FormItem>
                    <FormItem label="知识内容：">{{knowF.faultBe}}</FormItem>
                </template>
                <template v-else>
                    <FormItem label="故障类型：">{{knowF.faultType}}</FormItem>
                    <FormItem label="故障表现：">{{knowF.faultBe}}</FormItem>
                    <FormItem label="故障原因：">{{knowF.faultreason}}</FormItem>
                    <FormItem label="解决办法：">{{knowF.methods}}</FormItem>
                </template>
                <FormItem label="图片:">
                    <div class="zh-flex zh-flex-wrap ">
                        <img @click="handleView(domain+item)" v-for="(item,index) in knowF.imgs" :key="index" :src="domain+item" alt="" style="width:30%;">
                    </div>
                </FormItem>
                <FormItem label="标签:">{{knowF.tags}}</FormItem>
            </Form>
        </Modal>
        <Modal title="查看图片" v-model="visible" class="no_footer_modal">
            <img :src="imgName" v-if="visible" style="width: 100%">
        </Modal>
  </div>
</template>

<script>
import util from '@/libs/util.js'
import * as qiniu from 'qiniu-js'
import {getQiniuToken,getKnowledgeCondition,getInfoByReapireNum} from '@/libs/get.js'
import {getKnowledgeTable,saveKnowledge,isTop,deleteKnow} from '@/libs/post.js'
export default {
    name:'knowledgeBase',
    data () {
        return {
            btnp:{},
            btn:{
                zsku_xztm:false,
                zsku_cwxdztj:false,
                zsku_ck:false,
                zsku_bj:false,
                zsku_zd:false,
                zsku_qxzd:false,
                zsku_sc:false
            },
            proUuid:'',
            defaultName:'',
            canNext:true,
            clickSave:true,
            upLoadData:{
                token:'',
                unique_names: true,
                domain:this.$store.state.app.domain
            },
            domain:this.$store.state.app.domain,
            modal_viewKonw:false,
            knowF:{
                type:'',
                source:'',
                number:'',
                pro:'',
                addTime:'',
                title:'',
                faultType:'',
                faultBe:'',
                faultreason:'',
                methods:'',
                imgs:[],
                tags:'',
                sourceName:''
            } ,
            /**upload */
            imgName: '',
            visible: false,
            awaitUploadList:[],
            uploadList: [],
            copy_knowledgeForm:{},
            knowledgeForm:{
                entrytype:'',
                title:'',
                type:'',
                describe:'',
                reason:'',
                solve:'',
                image:'',
                label:'',
                flag:'save',
                uuid:''
            },
            repaireNumber:'',
            modal_addOther:false,
            loading:true,
            total:92,
            modal_knowledge:false,
            modal_knowledge_title:'',
            timeRange:[],
            formItem:{
                title:'',
                type:'全部',
                label:'全部',
                source:'全部',
                entryType:'全部',
                pageSize:10,
                pageNumber:1
            },
            entrytypeList:[
                {
                    label:'知识',
                    value:'1'
                },
                {
                    label:'故障',
                    value:'2'
                },                
            ],
            typeList:[],
            faultList:[],
            tagList:[],
            sourceList:[],
            itemTypeList:[],
            columns:[
                {
                    key:'title',
                    title:'条目标题',
                    minWidth:150
                },
                {
                    key:'typeName',
                    title:'类型',
                    align:'center',
                    minWidth:100
                },
                {
                    key:'label',
                    title:'标签',
                    minWidth:120
                },
                {
                    key:'sourceName',
                    title:'条目来源',
                    minWidth:120
                },
                {
                    key:'entrytypeName',
                    title:'条目类型',
                    minWidth:100
                },
                {
                    key:'created',
                    title:'新增时间',
                    align:'center',
                    minWidth:150
                },
                {
                    key:'action',
                    title:'操作',
                    align:'center',
                    minWidth:200,
                    fixed:'right',
                    render:(h,params)=>{
                        let top=params.row.istop;
                         return h('div',[
                            h('Button',{
                                props:{
                                type:'text',
                                size:'small'
                                },
                                style:{
                                color:'#2D8CF0',
                                display:this.btnp.zsku_ck?'inline-block':'none'
                                },
                                on:{
                                    click:()=>{
                                       
                                      this.goView(params.row) 
                                    }
                                }
                            },'查看'),
                            h('Button',{
                                props:{
                                type:'text',
                                size:'small'
                                },
                                style:{
                                color:'#2D8CF0',
                                display:this.btnp.zsku_bj?'inline-block':'none'
                                },
                                on:{
                                    click:()=>{
                                        this.goEdit(params.row);
                                    }
                                }
                            },'编辑'),
                            h('Button',{
                                props:{
                                type:'text',
                                size:'small'
                                },
                                style:{
                                color:'#2D8CF0',
                                display:this.btnp.zsku_zd?top=='0'?'inline-block':'none':'none'
                                },
                                on:{
                                    click:()=>{
                                         let config={
                                        title:'置顶条目',
                                        content:'置顶条目将在手机APP和管理后台同时置顶显示。',
                                        okText:'置顶',
                                        cancelText:'放弃操作',
                                        onOk:()=>{
                                            this.topChange(1,params.row.uuid)
                                        }
                                    }
                                    this.$Modal.confirm(config)
                                    }
                                }
                            },'置顶'),
                            h('Button',{
                                props:{
                                type:'text',
                                size:'small'
                                },
                                style:{
                                color:'#2D8CF0',
                                 display:this.btnp.zsku_qxzd?top=='1'?'inline-block':'none':'none'
                                
                                },
                                on:{
                                    click:()=>{
                                         let config={
                                        title:'取消置顶',
                                        content:'是否取消该条目在手机APP和管理后台的置顶？',
                                        okText:'取消置顶',
                                        cancelText:'放弃操作',
                                        onOk:()=>{
                                            this.topChange(0,params.row.uuid)
                                        }
                                    }
                                    this.$Modal.confirm(config)
                                    }
                                    
                                }
                            },'取消置顶'),
                            h('Button',{
                                props:{
                                type:'text',
                                size:'small'
                                },
                                style:{
                                color:'#EA0000',
                                 display:this.btnp.zsku_sc?'inline-block':'none'
                                },
                                on:{
                                click:()=>{
                                    
                                    let config={
                                        title:'删除知识条目',
                                        content:'删除后，该条目内容无法被专业版用户查看。',
                                        okText:'删除',
                                        cancelText:'放弃操作',
                                        onOk:()=>{
                                            this.delete(params.row.uuid)
                                        }
                                    }
                                    this.$Modal.confirm(config)
                                    }
                                }
                            },'删除'),
                         ])
                    }
                }
            ],
            data:[]
        };
    },
    methods:{
        async qiniuToken(){
            let res=await getQiniuToken();
            let response=res.data;
            if(response.code===200){
                this.upLoadData.token=JSON.parse(response.data).uptoken;
            }else{
                this.$Notice.error({
                    title: '请求出错',
                    desc:response.msg
                });
                return false
            }
        },
        async delete(uuid){
            let res=await deleteKnow({uuid});
            let response=res.data;
            if(response.code===200){
                this.$Notice.success({
                    desc:'已成功删除'
                });
                this.getTable();
            }else{
                this.$Notice.error({
                    desc:response.msg
                });
            }
        },
        async topChange(top,uuid){
            let res=await isTop({isTop:top,uuid});
            let response=res.data;
                if(response.code===200){
                    this.$Notice.success({
                        desc:top=='1'?'置顶成功':'取消置顶成功'
                    });
                    this.getTable();
                }else{
                    this.$Notice.error({
                        desc:response.msg
                    });
                }
        },
        goView(obj){
            this.knowF={
                type:obj.entrytypeName,
                source:obj.sourceName,
                number:obj.operationsingle,
                pro:obj.name,
                addTime:obj.created.slice(0,16),
                title:obj.title,
                faultType:obj.typeName,
                faultBe:obj.describe,
                faultreason:obj.reason,
                methods:obj.solve,
                imgs:!!obj.image?obj.image.split(','):[],
                tags:obj.label,
                sourceName:obj.sourceName
            }
            this.modal_viewKonw=true;
        },
        goEdit(obj){
            
            this.modal_knowledge_title="编辑知识条目";
            this.knowledgeForm={
                entrytype:obj.entrytype,
                title:obj.title,
                type:obj.type,
                describe:obj.describe,
                reason:obj.reason,
                solve:obj.solve,
                image:obj.image,
                label:obj.label,
                flag:'edit',
                uuid:obj.uuid
            };
            this.repaireNumber=obj.operationsingle;
            this.defaultName=obj.entrytypeName;
            let arr=!!obj.image?obj.image.split(','):[];
            this.awaitUploadList=arr;
            this.uploadList=arr.map(item=>{
                let a={
                    status:'finished',
                    response:{
                        hash:item
                    }
                }
                return a
            });
            this.modal_knowledge=true;
        },
        async saveKnow(){
            let source=!!this.repaireNumber?'1':'0';
            let operationsingle=this.repaireNumber;
            let {
                entrytype,
                title,
                type,
                describe,
                reason,
                solve,
                image,
                label,
                flag,
                uuid
            }=this.knowledgeForm;
            let proUuid=this.proUuid;
            image=this.uploadList.map(item=>{
                return item.response.hash
            }).join(',');
            let res=await saveKnowledge({
                source,
                operationsingle,
                entrytype,
                title,
                type,
                describe,
                reason,
                solve,
                image,
                label,
                flag,
                uuid,
                proUuid});
            let response=res.data;
            if(response.code===200){
                this.$Notice.success({
                    desc:'保存成功'
                })
                this.getTable();
                this.getCondition();
                this.modal_knowledge=false;
            }else{
                this.$Notice.error({
                    title: '请求出错',
                    desc:response.msg
                });
                
            }
        },
        async judgeSaveKnow(){
            if(this.clickSave){
                this.clickSave=false;
                let arr=this.knowledgeForm.label.split('，');
                    let arr2=arr.map(item=>{
                        if(item.length>10){
                            return 0
                        }
                        return 1
                    });
                if(!this.knowledgeForm.entrytype){
                    this.$Notice.error({
                        desc:'请选择条目类型'
                    })
                }else if(!this.knowledgeForm.title){
                    this.$Notice.error({
                        desc:'请输入条目标题'
                    })
                }else if(!this.knowledgeForm.type){
                    this.$Notice.error({
                        desc:this.knowledgeForm.entrytype=='1'?'请选择知识类型':'请选择故障类型'
                    })
                }else if(!this.knowledgeForm.describe){
                    this.$Notice.error({
                        desc:this.knowledgeForm.entrytype=='1'?'请输入知识内容':'请输入故障表现'
                    })
                }else if(this.knowledgeForm.entrytype=='2'){
                    if(!this.knowledgeForm.reason){
                        this.$Notice.error({
                            desc:'请输入故障原因'
                        })
                    }else if(!this.knowledgeForm.solve){
                        this.$Notice.error({
                            desc:'请输入解决办法'
                        })
                    }else if(!this.knowledgeForm.label){
                        this.$Notice.error({
                            desc:'请输入标签'
                        })
                    }else if(arr.length>5){
                        this.$Notice.error({
                            desc:'标签最多输入5个'
                        })
                    }else if(arr2.includes(0)){
                        this.$Notice.error({
                            desc:'一个标签最多10个字符'
                        })
                    }else{
                        await this.saveKnow()
                    }
                }else if(!this.knowledgeForm.label){
                    this.$Notice.error({
                            desc:'请输入标签'
                        })
                }else if(arr.length>5){
                        this.$Notice.error({
                            desc:'标签最多输入5个'
                        })
                }else if(arr2.includes(0)){
                    this.$Notice.error({
                        desc:'一个标签最多10个字符'
                    })
                }else{
                    await this.saveKnow()
                }
                this.clickSave=true;
            }
        },
        async getCondition(){
            let res=await getKnowledgeCondition();
            let response=res.data;
            if(response.code===200){
                this.typeList=[{state:'全部',desc:'全部'},...response.data.faulttype];
                this.faultList=response.data.faulttype;
                this.itemTypeList=[{state:'全部',desc:'全部'},...response.data.entryType];
                this.sourceList=[{state:'全部',desc:'全部'},...response.data.source];
                let tags=response.data.label.map(item=>{
                    return {
                        state:item.label,
                        desc:item.label
                    }
                });
                this.tagList=[{state:'全部',desc:'全部'},...tags];
            }else{
                this.$Notice.error({
                title: '请求出错',
                desc:response.msg
                });
            }
        },
        searchgetTable(){
            this.formItem.pageNumber=1;
            this.getTable();
        },
        async getTable(){
            this.loading=true;
            let form=JSON.parse(JSON.stringify(this.formItem));
            for(let key in form){
                if(form[key]==='全部'){
                form[key]='';
                }
            }
            if(!!this.timeRange[0]&&this.timeRange.length>0){
                form.startTime=util.time1(this.timeRange[0]);
                form.endTime=util.time1(this.timeRange[1]);
            }else{
                form.startTime='';
                form.endTime='';
            }
            
            let res=await getKnowledgeTable(form);
            let response=res.data;
            if(response.code===200){
                this.total=response.data.total;
                this.data=response.data.rows.map(item=>{
                    item.created=item.created.slice(0,16)
                    return item
                });  
                this.loading=false;
            }else{
                this.$Notice.error({
                title: '失败',
                desc:response.msg
                });
            }
        },
        pageSizeChange(size){
        //回到第一页
            this.formItem.pageNumber=1;
            this.formItem.pageSize=size;
            this.getTable();
        },
        pageChange(number){
            this.formItem.pageNumber=number;
            this.getTable();
        },
        async next(){
            if(!this.canNext){
              return   
            }else if(!this.repaireNumber){
                this.$Notice.error({
                    desc:'请输入维修单号'
                })
            }else{
                let res=await getInfoByReapireNum(this.repaireNumber);
                let response=res.data;
                if(response.code===200){
                    this.knowledgeForm.entrytype='2';
                    this.defaultName=response.data.type_name;
                    this.modal_knowledge_title="新增知识条目";
                    this.modal_knowledge=true;
                    this.modal_addOther=false;
                    this.awaitUploadList=response.data.image;
                    this.proUuid=response.data.pro_uuid;
                    this.knowledgeForm.type=response.data.type_uuid;
                    this.uploadList=response.data.image.map(item=>{
                        let src=item.replace(this.domain,'');
                        let a={
                            status:'finished',
                            response:{
                                hash:src
                            }
                        }
                        return a
                    });
                    this.knowledgeForm.describe=response.data.describe;
                    this.knowledgeForm.reason=response.data.reason;
                    this.knowledgeForm.solve=response.data.solve;
                }else{
                    this.$Notice.error({
                        desc:response.msg
                    });
                    return false
                }
            }



            
        },
        entrytypeChange(value){
            this.knowledgeForm=JSON.parse(JSON.stringify(this.copy_knowledgeForm));
            this.knowledgeForm.entrytype=value;
            this.uploadList=[];
            this.awaitUploadList=[];
        },
        handleClickAddForm(){
            this.modal_knowledge=true;
            this.modal_knowledge_title="新增知识条目";
        },
        handleView (item) {
            this.imgName = item;
            this.visible = true;
        },
        handleRemove (file,index) {
            this.uploadList.splice(index,1);
            if(!!file.name){
                const name=file.name;            
                this.awaitUploadList.splice(this.awaitUploadList.findIndex(function(value,index,arr){
                    if(value.name===name){
                        return index
                    }
                }),1)
            }else{
                this.awaitUploadList.splice(index,1)
            }     
        },
        handleSuccess (res, file) {
            this.uploadList.push(file);
        },
        handleErr(res,file){
            this.awaitUploadList.splice(this.awaitUploadList.findIndex(function(value,index,arr){
                if(value.name===file.name){
                    return index
                }
            }),1)
        },
        handleFormatError (file) {
            this.$Notice.warning({
                title: '图片格式错误',
                desc: '请选择 jpg 或 png 格式的图片'
            });
        },
        handleMaxSize (file) {
            this.$Notice.warning({
                title: '图片过大',
                desc: '请选择文件大小小于2M的图片'
            });
        },
        handleBeforeUpload (file) {
            if(this.awaitUploadList.length<3){
                this.awaitUploadList.push(file);
                return true
            }
            else{
                this.$Notice.warning({
                    title: '最多上传三张图片。'
                });
                return false
            }
        }
    },
    watch:{
        modal_knowledge:function(){
            
            if(!this.modal_knowledge){
                let that=this;
                setTimeout(() => {
                    that.repaireNumber='';
                    that.uploadList=[];
                    that.awaitUploadList=[];
                    that.knowledgeForm=JSON.parse(JSON.stringify(this.copy_knowledgeForm));
                }, 500);
                
                
            }else{
                this.qiniuToken();
            }
        },
        modal_viewKonw:function(){
            if(!this.modal_viewKonw){
                let that=this;
                setTimeout(() => {
                    that. knowF={
                        type:'',
                        source:'',
                        number:'',
                        pro:'',
                        addTime:'',
                        title:'',
                        faultType:'',
                        faultBe:'',
                        faultreason:'',
                        methods:'',
                        imgs:[],
                        tags:''
                    }   
                }, 500);
                
            }
        }
    },
    created(){
        this.copy_knowledgeForm=JSON.parse(JSON.stringify(this.knowledgeForm));
        this.getCondition();
        this.getTable();
        this.btnp=util.bpower(this,this.btn);
    },
    


}

</script>
<style lang='scss' >
.demo-upload-list{
        display: inline-block;
        width: 60px;
        height: 60px;
        text-align: center;
        line-height: 60px;
        border: 1px solid transparent;
        border-radius: 4px;
        overflow: hidden;
        background: #fff;
        position: relative;
        box-shadow: 0 1px 1px rgba(0,0,0,.2);
        margin-right: 4px;
        img{
            width: 100%;
            height: 100%;
        }
    }
    .demo-upload-list-cover{
        display: none;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0,0,0,.6);
        i{
            color: #fff;
            font-size: 20px;
            cursor: pointer;
            margin: 0 2px;
        }
    }
    .demo-upload-list:hover .demo-upload-list-cover{
        display: block;
    }
 
</style>